<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id = "app">
        <input type="text" v-model="mytext">
        <button @click="handclick()">添加</button>
        <div v-for="(item,i) in dataList">
            {{item}}-------<button @click="remove(i)">删除</button>
        </div>
    </div>

    <script>
        var vm = new Vue({
            el:"#app",
            data:{
                mytext:'',
                dataList:["aaa","bbb","ccc"]
            },
            methods:{
                remove(i){
                    this.dataList.splice(i,1)
                },
                handclick(){
                    console.log(this)
                    this.dataList.push(this.mytext)
                    this.mytext = ''
                }
            }
        })
    </script>
</body>
</html>